package com.ruoyi.system.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.Members;

import java.util.List;

/**
 * 系统会员信息Mapper接口
 * 
 * @author 陈斌斌
 * @date 2025-09-17
 */
public interface MembersMapper extends BaseMapper<Members>
{
    /**
     * 多条件查询
     * @return  List<Members>
     */
    default List<Members> selectMembersList(Members members){
    return new LambdaQueryChainWrapper<>(this)
            .like(StringUtils.isNotEmpty(members.getPhone()),Members::getPhone,members.getPhone())
            .like(StringUtils.isNotEmpty(members.getFullName()),Members::getFullName,members.getFullName())
            .eq(StringUtils.isNotEmpty(members.getGender()),Members::getGender,members.getGender())
            .eq(StringUtils.isNotEmpty(members.getStatus()),Members::getStatus,members.getStatus())
            .between(StringUtils.isNotNull(members.getBeginCreateTime()),Members::getCreateTime,members.getBeginCreateTime(),members.getEndCreateTime())
            .orderByDesc(Members::getUpdateTime)
            .list();
}
    /**
     * 根据会员名称查询是否存在
     * @return Members
     */
    default Members selectMembersByFullName(String fullName){
        return new LambdaQueryChainWrapper<>(this)
                .eq(StringUtils.isNotEmpty(fullName),Members::getFullName,fullName).one();
    }
}
